package me.yushuai.wukong.base.repository;

import me.yushuai.wukong.base.entity.ConfigVariable;
import me.yushuai.wukong.common.persistence.repository.BaseBizRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * @author zhoushuai@189.cn
 * @since 2023-05-24
 */
@Repository
public interface ConfigVariableRepository extends BaseBizRepository<ConfigVariable, Long, String> {

    @Query("from ConfigVariable where confId = ?1 and id =?2")
    Optional<ConfigVariable> findById(Long configId, Long variableId);

    @Query("from ConfigVariable where confId =?1 and name =?2")
    Optional<ConfigVariable> findByBizId(String conf, String variable);
}
